<template>
    <el-form :model="signForm" label-position="top" size="small">
        <template v-if="isSign === 1">
            <el-form-item class="mb5" label="用户名">
                <el-input ref="registerFocus" v-model="signForm.name"></el-input>
            </el-form-item>
        </template>
        <el-form-item class="mb5" label="手机号 或 Email">
            <el-input ref="loginFocus" v-model="signForm.tel"></el-input>
        </el-form-item>
        <el-form-item class="mb5" label="密码">
            <el-input v-model="signForm.password" type="password"></el-input>
        </el-form-item>
        <el-button type="text">{{ sign.btnText }}</el-button>
        <template v-if="isSign === 0">
            <el-button class="fr" type="text">忘记密码</el-button>
        </template>
        <el-button class="success mt5" type="primary" size="small" @click="close">{{ sign.title }}</el-button>
    </el-form>
</template>

<script>
export default {
    name: 'sign-form',
    props: {
        isSign: Number
    },
    data() {
        return {
            signForm: {
                name: '',
                tel: '',
                password: ''
            }
        }
    },
    computed: {
        sign() {
            return this.isSign === 0 ? { btnText: '注册新账号', title: '登录' } : { btnText: '已有账号登录', title: '注册' }
        }
    },
    methods: {
        close() {
            this.$emit('close')
        }
    }
}
</script>

<style scoped>

</style>